JDBC, can't connect to postgres

Поиск
Список
Период
Сортировка
От Anders Svensson
Тема JDBC, can't connect to postgres
Дата
Msg-id v04020a00b40d2269e0b6@[192.168.1.3]
обсуждение исходный текст
Список pgsql-interfaces
I am trying to use postgres as  database server on a servlet run under
Apache and jserv

Problem is when I isue the  Class.forName("postgresql.Driver")
I get an ClassNotFound Exception.

The latest driver for jdbc   (jdbc6.5-1.2.jar) is the only path in my
CLASSPATH.

The java-program compiles just fine, and postmaster is started with the -i
option.
I am running the java program for a test without apache and servlet, on the
same machine as postmaster is on, but as a different user.
the config file for postmaster includes

local all trust

Any suggestions????

import java.io.*;
import java.net.*;
import java.sql.*;

public class test {
   public static void main (String args[]) {
       try {           Class.forName("postgresql.Driver");           System.out.println("Class.forName OK!");
           String url = "jdbc:postgresql://192.168.1.1/fraggi";           String usr ="root";           String pwd
="";
           Connection db = DriverManager.getConnection (url,usr,pwd);
           if (db !=null)               System.out.println("Connected OK to database");           else
System.out.println("Faildto connect");       }
 
       catch (Exception e) {           System.out.println(e.toString());       }   }

}
Simu Soft
v/Anders Svensson
Frederikssundsvej 20, 2 th
DK-2400  København NV

e-mail     : Anders@simusoft.dk
tlf.    : +45 3583 8126



В списке pgsql-interfaces по дате отправления:

Предыдущее
От: Antonio Pires
Дата:
Сообщение: pg_database
Следующее
От: "Geeta Mahesh"
Дата:
Сообщение: Table name of a select query.